<template>
	<div class="oe-student-manage" v-loading="loading">
		<top-tip :title="title" :showBack="false"></top-tip>
		<div class="oe-manage-search">
			<span class="oe-manage-text">姓名/用户名：</span>
			<span class="oe-manage-input">
				<a-input placeholder="请输入姓名/用户名" v-model="username" />
			</span>
			<span class="oe-manage-text">班级：</span>
			<span class="oe-manage-select">
				<a-select showSearch :allowClear="true" optionFilterProp="children" :filterOption="false" v-model="selectType" placeholder="请选择班级" style="width: 20%" @search="handleSearch" @change="handleChange" @focus="handleFocus">
					<a-select-option v-for="(item, index) in classlist" :index="index" :key="item.id">
						{{
              item.text
              }}
					</a-select-option>
				</a-select>
			</span>
			<span class="oe-manage-btns">
				<a-button type="primary" @click.stop="getStudentList">查询</a-button>
				<a-button type="primary" v-show="isShow" @click="showModal" v-if="operationList.includes('add/edit/del')">从职教云导入</a-button>
				<a-button type="primary" @click="clickAction('新增')" v-if="operationList.includes('add/edit/del')">新增</a-button>
				<a-button type="primary" @click="importExcelQues" v-if="operationList.includes('add/edit/del')">Excel导入</a-button>
				<a-button @click="updateClass" v-if="operationList.includes('add/edit/del')">修改班级</a-button>
				<a-button @click="deleted" v-if="operationList.includes('add/edit/del')">批量删除</a-button>
				<a-button @click="resetPwd" v-if="operationList.includes('add/edit/del')">重置密码</a-button>
				<a-button @click="uploadAvator" v-if="operationList.includes('add/edit/del')">上传文件夹头像</a-button>
				<a-button @click="importExcelQuesAvatorUrl" v-if="operationList.includes('add/edit/del')">上传压缩包头像</a-button>
			</span>
			<a-modal :title="texttitle" :afterClose="afterClose" class="oe-studentAdd" :visible="add" @cancel="add = false">
				<div class="oe-select">
					<a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
						<a-form-model-item label="用户名" prop="UserName" ref="UserName">
							<a-input :disabled="userdisable" v-model="form.UserName" class="oe-tooltip-input" @blur="
                    () => {
                      $refs.UserName.onFieldBlur();
                    }
                  " />
						</a-form-model-item>
						<a-form-model-item label="学生姓名" prop="DisplayName" ref="DisplayName">
							<a-input v-model="form.DisplayName" :disabled="isOnlyInfo" class="oe-tooltip-input" @blur="
                    () => {
                      $refs.DisplayName.onFieldBlur();
                    }
                  " />
							<a-tooltip placement="bottom" class="oe-push-top__title" v-if="isOnlyInfo">
								<template slot="title">
									<span class="oe-title-content">该用户已开通其他平台，不允许修改姓名</span>
								</template>
								<i class="iconfont icon-wenti"></i>
							</a-tooltip>
						</a-form-model-item>
						<a-form-model-item label="学生学号" prop="UserNo" ref="UserNo">
							<a-input v-model="form.UserNo" :disabled="isOnlyInfo" class="oe-tooltip-input" @blur="
                    () => {
                      $refs.UserNo.onFieldBlur();
                    }
                  " />
							<a-tooltip placement="bottom" class="oe-push-top__title" v-if="isOnlyInfo">
								<template slot="title">
									<span class="oe-title-content">该用户已开通其他平台，不允许修改学号</span>
								</template>
								<i class="iconfont icon-wenti"></i>
							</a-tooltip>
						</a-form-model-item>
						<a-form-model-item label="手机号" prop="Mobile" ref="Mobile">
							<a-input v-model="form.Mobile" :disabled="isOnlyMoble" class="oe-tooltip-input" />
							<a-tooltip placement="bottom" class="oe-push-top__title" v-if="isOnlyMoble">
								<template slot="title">
									<span class="oe-title-content">该用户手机号已验证通过，不允许修改</span>
								</template>
								<i class="iconfont icon-wenti"></i>
							</a-tooltip>
						</a-form-model-item>
						<a-form-model-item label="邮箱" prop="Email" ref="Email">
							<a-input-group compact>
								<a-auto-complete v-model="form.Email" :data-source="dataSource" style="width: 255px" placeholder="邮箱" @change="handleChangeEmail" />
							</a-input-group>
						</a-form-model-item>
						<a-form-model-item label="性别" prop="Sex" ref="Sex">
							<a-select v-model="form.Sex" style="width: 257px" placeholder="请选择性别">
								<a-select-option value="男">男</a-select-option>
								<a-select-option value="女">女</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="所属院系" prop="SubName">
							<a-select v-model="form.SubName" showSearch @change="Changesub" :allowClear="true" optionFilterProp="children" placeholder="请选择院系" class="oe-tooltip-input">
								<a-select-option v-for="(item, index) in sublist" :value="item.id" :index="index" :key="item.id">
									{{
                    item.text
                    }}
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="所属专业" prop="MajorName">
							<a-select v-model="form.MajorName" showSearch @change="Changemajor" :allowClear="true" optionFilterProp="children" placeholder="请选择专业" class="oe-tooltip-input">
								<a-select-option v-for="(item, index) in majorlist" :value="item.Id" :index="index" :key="item.Id">
									{{
                    item.Name
                    }}
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="所属年级" prop="GradeName">
							<a-select v-model="form.GradeName" showSearch @change="Changegrade" :allowClear="true" optionFilterProp="children" placeholder="请选择年级" class="oe-tooltip-input">
								<a-select-option v-for="(item, index) in gradelist" :value="item.id" :index="index" :key="item.id">
									{{
                    item.text
                    }}
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="所属班级" prop="ClassName">
							<a-select v-model="form.ClassName" @change="Changeclass" showSearch :allowClear="true" optionFilterProp="children" placeholder="请选择班级" class="oe-tooltip-input">
								<a-select-option v-for="(item, index) in classlist" :index="index" :key="item.id">
									{{
                    item.text
                    }}
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="头像" prop="fileListOne">
							<oe-upload v-model="fileListOne"></oe-upload>
						</a-form-model-item>
					</a-form-model>
				</div>
				<template slot="footer">
					<a-button @click="saveedit" type="primary" html-type="submit">确定</a-button>
					<a-button @click.stop="add = false">取消</a-button>
				</template>
			</a-modal>
			<a-modal title="修改班级" class="oe-studentAdd" :visible="editClass" @cancel="onClassCancle" :afterClose="onClassCancle">
				<div class="oe-select">
					<a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
						<a-form-model-item label="所属班级" prop="ClassName">
							<a-select v-model="form.ClassName" @change="Changeclass" showSearch :allowClear="true" optionFilterProp="children" placeholder="请选择班级" class="oe-tooltip-input">
								<a-select-option v-for="(item, index) in classlist" :index="index" :key="item.id">
									{{
                    item.text
                    }}
								</a-select-option>
							</a-select>
						</a-form-model-item>
					</a-form-model>
				</div>
				<template slot="footer">
					<a-button @click="saveClass" type="primary" html-type="submit">确定</a-button>
					<a-button @click.stop="editClass = false">取消</a-button>
				</template>
			</a-modal>
			<a-modal title="导入学生" class="oe-student" :visible="visible" width="926px" @cancel="closeex" :afterClose="afterCloseImport">
				<div class="oe-select">
					<span class="oe-manage-select">
						<a-select v-model="zjysub" @change="zjysubs" showSearch :allowClear="true" optionFilterProp="children" placeholder="请选择院系" style="width: 20%">
							<a-select-option v-for="(item, index) in zjysublist" :value="item.Id" :index="index" :key="item.Id">
								{{
                  item.Name
                  }}
							</a-select-option>
						</a-select>
					</span>
					<span class="oe-manage-select">
						<a-select v-model="zjygrade" @change="zjygrades" showSearch :allowClear="true" optionFilterProp="children" placeholder="请选择年级" style="width: 20%">
							<a-select-option v-for="(item, index) in zjygradelist" :value="item.Id" :index="index" :key="item.Id">
								{{
                  item.Name
                  }}
							</a-select-option>
						</a-select>
					</span>
					<span class="oe-manage-select">
						<a-select v-model="zjyclass" @change="zjyclasses" showSearch :allowClear="true" optionFilterProp="children" placeholder="请选择班级" style="width: 20%">
							<a-select-option v-for="(item, index) in zjyclasslist" :value="item.id" :index="index" :key="item.id">
								{{
                  item.text
                  }}
							</a-select-option>
						</a-select>
					</span>
					<span class="oe-select-input">
						<a-input placeholder="请输入姓名/学号" v-model="exportName" />
					</span>
					<a-button type="primary" @click.stop="getZJYList">查询</a-button>
				</div>
				<div class="oe-select-table">
					<a-table :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :columns="exportor" :dataSource="student" :scroll="{ y: 240 }" :pagination="paginationex" @change="exChange">
						<span slot="action">
							<a-tooltip placement="bottom" title="查看">
								<span class="action-icon">
									<i class="iconfont icon-chakan"></i>
								</span>
							</a-tooltip>
							<a-tooltip placement="bottom" title="编辑">
								<span class="action-icon">
									<i class="iconfont icon-edit"></i>
								</span>
							</a-tooltip>
						</span>
					</a-table>
				</div>
				<template slot="footer">
					<a-button @click.stop="importZJYStudent" type="primary" html-type="submit">确定</a-button>
					<a-button @click.stop="closeex">取消</a-button>
				</template>
			</a-modal>
			<a-modal title="成绩详情" class="oe-student" :visible="grade" width="70%" @cancel="grade = false">
				<div class="oe-select">
					<span class="oe-question-text">考试标题：</span>
					<span class="oe-select-input">
						<a-input placeholder="输入考试标题" v-model="exam" allow-clear />
					</span>
					<a-button type="primary" @click.stop="getScoreDetails">查询</a-button>
				</div>
				<div class="oe-select-table">
					<a-table :columns="gradeColumn" :pagination="paginationDetail" :dataSource="gradeSource" :scroll="{ y: 240 }" @change="TableChange">
						<span slot="PaperType" slot-scope="PaperType">{{ PaperType.PaperType == 1 ? '客观' : '主观' }}</span>
					</a-table>
				</div>
				<template slot="footer">
					<a-button @click="grade = false" type="primary" html-type="submit">确定</a-button>
					<!-- <a-button @click.stop="grade = false">取消</a-button> -->
				</template>
			</a-modal>

			<a-modal title="上传学生照片" class="oe-student" :visible="importStuAvatorUrl" width="40%" @cancel="offBatchupload">
				<div class="oe-select">
					<span class="oe-manage-select">
						<h2>注意事项：</h2>
						<div>
							1、照片的命名规则为
							<b style="color:red">用户名.图片格式</b>，如
							<b style="color:red">341221200006066666.jpg</b>
						</div>
						<div>2、照片要求为 彩底免冠小二寸证件照片（蓝底红底均可）</div>
						<div>3、照片的大小要控制在50kb~500kb之间</div>
						<div>4、请先将学生照片放到统一文件夹内，选择到这个文件夹即可进行上传！</div>
					</span>
				</div>
				<div>
					<!-- <div class="clearfix">
              <a-upload :fileList="fileList" :remove="handleRemove" :beforeUpload="beforeUpload" accept=".zip">
                <a-button> <a-icon type="upload" /> 选择文件 </a-button>
              </a-upload>
            </div>-->
					<oe-batch-upload v-model="files"></oe-batch-upload>
				</div>
				<div class="oe-select-table">
					<a-table :columns="errorColumns" :dataSource="errorList" :pagination="false" v-if="errorList.length > 0"></a-table>
				</div>
				<template slot="footer">
					<a-button type="primary" @click="onAllFilesUpload" :disabled="files.length == 0" :loading="uploading" style="margin-top: 16px">上传</a-button>
					<a-button @click.stop="offBatchupload">取消</a-button>
				</template>
			</a-modal>

			<a-modal title="excel导入" class="oe-student" :visible="importExcel" width="40%" @cancel="importedCancelExcel">
				<div class="oe-select">
					<span class="oe-manage-select">
						<h2>注意事项：</h2>
						<div>1、导入excel前建议先查看下载模板中的示例，按要求添加导入信息</div>
						<div>2、请按照模板规范顺序导入数据,带"*"为必填项</div>
						<div>3、一次上传的数量请不要大于3000条</div>
					</span>
				</div>
				<div class="oe-select">
					<a href="/exam/excel/导入学生.xlsx">下载模板</a>
				</div>
				<div>
					<div class="clearfix">
						<a-upload :fileList="fileList" :remove="handleRemove" :beforeUpload="beforeUpload" accept=".xlsx">
							<a-button>
								<a-icon type="upload" />选择文件
							</a-button>
						</a-upload>
					</div>
				</div>
				<div class="oe-select-table">
					<a-table :columns="errorColumns" :dataSource="errorList" :pagination="false" v-if="errorList.length > 0"></a-table>
				</div>
				<template slot="footer">
					<a-button type="primary" v-if="!isContinue" @click="handleUpload(0)" :disabled="fileCount === 0" :loading="uploading" style="margin-top: 16px">{{ uploading ? '上传中' : '上传' }}</a-button>
					<a-button type="primary" v-if="isContinue" @click="handleUpload(1)" :disabled="fileCount === 0" :loading="uploading" style="margin-top: 16px">{{ uploading ? '上传中' : '继续上传' }}</a-button>
					<a-button @click.stop="importedCancelExcel">取消</a-button>
				</template>
			</a-modal>
			<a-modal title="学生头像导入" class="oe-student" :visible="importAvatorUrl" width="40%" @cancel="importedCancelAvatorUrl">
				<div class="oe-select">
					<span class="oe-manage-select">
						<h2>注意事项：</h2>
						<div>
							1、照片的命名规则为
							<b style="color:red">用户名.图片格式</b>，如
							<b style="color:red">341221200006066666.jpg</b>
						</div>
						<div>2、学生头像只支持.jpg和.png格式的图片</div>
						<div>3、支持单个图片上传和压缩包上传</div>
						<div>4、如果上传压缩包，里面可以放多张图片，格式为.jpg和.png格式</div>
						<div>5、如果上传压缩包，里面的图片请不要大于1000张，否则会导致上传失败</div>
					</span>
				</div>
				<!-- <div class="oe-select">
            <a href="/exam/excel/导入学生.xlsx">下载模板</a>
          </div>-->
				<div>
					<div class="clearfix">
						<a-upload :fileList="fileListAvatorUrl" :remove="handleRemoveAvatorUrl" :beforeUpload="beforeUploadAvatorUrl" accept=".zip, .jpg, .png">
							<a-button>
								<a-icon type="upload" />选择文件
							</a-button>
						</a-upload>
					</div>
				</div>
				<div class="oe-select-table">
					<a-table :columns="errorColumns" :dataSource="errorList" :pagination="false" v-if="errorList.length > 0"></a-table>
				</div>
				<template slot="footer">
					<a-button type="primary" @click="handleUploadAvatorUrl " :disabled="fileCountAvatorUrl === 0" :loading="uploading" style="margin-top: 16px">{{ uploading ? '上传中' : '上传' }}</a-button>
					<a-button @click.stop="importedCancelAvatorUrl">取消</a-button>
				</template>
			</a-modal>
		</div>
		<div class="oe-student-contain">

			<div class="oe-manage-content">
				<a-table :rowSelection="{ selectedRowKeys: selectedStudent, onChange: onSelectStudent }" :columns="columns" :dataSource="dataList" :pagination="pagination" @change="onTableChange" v-pic>
					<span slot="AvatorUrl" slot-scope="text, record">
						<img v-if="record.AvatorUrl != ''" :src="record.AvatorUrl" />
						<span v-else>未上传</span>
					</span>
					<span slot="action" slot-scope="text, record">
						<a-tooltip placement="bottom" title="查看">
							<span @click="clickAction('查看', record)" class="action-icon">
								<i class="iconfont icon-chakan"></i>
								<span>查看</span>
							</span>
						</a-tooltip>
						<a-tooltip placement="bottom" title="编辑" class="bianji">
							<span @click="clickAction('编辑', record)" v-if="operationList.includes('add/edit/del')" class="action-icon">
								<i class="iconfont icon-edit"></i>
								<span>编辑</span>
							</span>
						</a-tooltip>
						<a-tooltip placement="bottom" title="删除">
							<span @click="clickAction('删除', record)" v-if="operationList.includes('add/edit/del')" class="action-icon">
								<i class="iconfont icon-delete"></i>
								<span>删除</span>
							</span>
						</a-tooltip>
					</span>
				</a-table>
			</div>
		</div>
	</div>
</template>

<script>
import topTip from '@/components/top-tip/index.vue';
import GetOperationList from '@/lib/mixin/methods.js';
import oeUpload from '@/components/oe-upload';
import oeBatchUpload from '@/components/oe-batch-upload';
export default {
	mixins: [GetOperationList],
	components: {
		topTip,
		oeUpload,
		oeBatchUpload,
	},
	data() {
		return {
			//导入
			exportName: undefined,
			// 图片的list
			fileListOne: [],
			zjyclass: undefined,
			zjygrade: undefined,
			zjysub: undefined,
			//是否展示从职教云导入
			isShow: false,
			//年级列表
			gradelist: [],
			editClass: false,
			//院系列表
			sublist: [],
			//专业列表
			majorlist: [],
			lookItem: '',
			texttitle: '编辑信息',
			title: [{ text: '学生管理' }],
			username: '',
			classlist: [],
			// 操作List
			operationList: [],
			// 、操作list
			IsOpList: [],
			// 数据加载
			loading: false,
			paginationex: {
				pageSizeOptions: ['10', '20', '50', '100', '1000'],
				showQuickJumper: true,
				showSizeChanger: true,
				showTotal(total) {
					return `共 ${total} 条`;
				},
				onShowSizeChange: (current, pageSize) => {
					this.paginationex.current = current;
					this.paginationex.pageSize = pageSize;
				},
				onChange: (current, pageSize) => {
					// this.getExamList(current, pageSize);
					this.paginationex.current = current;
					this.paginationex.pageSize = pageSize;
				},
				buildOptionText(props) {
					// console.log(props);
					return props.value + '条/页';
				},
				current: 1,
				pageSize: 10,
				total: 0,
			},
			paginationDetail: {
				pageSizeOptions: ['10', '20', '50', '100', '1000'],
				showQuickJumper: true,
				showSizeChanger: true,
				showTotal(total) {
					return `共 ${total} 条`;
				},
				onShowSizeChange: (current, pageSize) => {
					console.log('123');
					this.paginationDetail.current = current;
					this.paginationDetail.pageSize = pageSize;
				},
				onChange: (current, pageSize) => {
					// this.getExamList(current, pageSize);
					console.log('123');
					this.paginationDetail.current = current;
					this.paginationDetail.pageSize = pageSize;
				},
				buildOptionText(props) {
					// console.log(props);
					return props.value + '条/页';
				},
				current: 1,
				pageSize: 10,
				total: 0,
			},
			// 分页配置
			pagination: {
				pageSizeOptions: ['10', '20', '50', '100', '1000'],
				showQuickJumper: true,
				showSizeChanger: true,
				showTotal(total) {
					return `共 ${total} 条`;
				},
				onShowSizeChange: (current, pageSize) => {
					this.pagination.current = current;
					this.pagination.pageSize = pageSize;
				},
				onChange: (current, pageSize) => {
					// this.getExamList(current, pageSize);
					this.pagination.current = current;
					this.pagination.pageSize = pageSize;
				},
				buildOptionText(props) {
					// console.log(props);
					return props.value + '条/页';
				},
				current: 1,
				pageSize: 10,
				total: 0,
			},
			question: '',
			selectType: [], //选择的类型
			selectedRowKeys: [],
			selectedStudent: [],
			visible: false,
			//成绩详情
			grade: false,
			exam: '',
			gradeColumn: [
				{
					title: '序号',
					dataIndex: 'Number',
					align: 'center',
				},
				{
					title: '标题',
					dataIndex: 'Title',
					sorter: true,
					align: 'center',
				},
				{
					title: '开始时间',
					dataIndex: 'StartTime',
					sorter: true,
					align: 'center',
				},
				{
					title: '结束时间',
					dataIndex: 'EndTime',
					sorter: true,
					align: 'center',
				},
				{
					title: '客观/主观',
					key: 'PaperType',
					sorter: true,
					align: 'center',
					scopedSlots: { customRender: 'PaperType' },
				},
				{
					title: '考试总分',
					sorter: true,
					dataIndex: 'TotalScore',
					align: 'center',
				},
				{
					title: '学生得分',
					dataIndex: 'GetScore',
					sorter: true,
					align: 'center',
				},
				{
					title: '是否合格',
					dataIndex: 'Qualified',
					align: 'center',
				},
			],
			gradeSource: [],
			//新增
			add: false,
			labelCol: { span: 4 },
			wrapperCol: { span: 14 },
			form: {
				UserName: '',
				DisplayName: '',
				UserNo: '',
				SubName: [],
				MajorName: [],
				GradeName: [],
				ClassName: [],
				fileListOne: [],
				Mobile: '',
				Sex: undefined,
				Email: '',
			},
			rules: {
				UserName: [
					{ required: true, message: '请输入用户名', trigger: 'blur' },
					{ min: 6, max: 30, message: '请输入6-30个字符', trigger: 'blur' },
				],
				DisplayName: [{ required: true, message: '请输入学生姓名', trigger: 'blur' }],
				UserNo: [{ required: true, message: '请输入学号', trigger: 'blur' }],
				SubName: [{ required: true, message: '请选择院系', trigger: 'change' }],
				MajorName: [{ required: true, message: '请选择专业', trigger: 'change' }],
				GradeName: [{ required: true, message: '请选择年级', trigger: 'change' }],
				ClassName: [{ required: true, message: '请选择班级', trigger: 'change' }],
			},
			//职教云导入
			student: [],
			exportor: [
				{
					title: '序号',
					dataIndex: 'Number',
					align: 'center',
					key: 'Number',
				},
				{
					title: '用户名',
					dataIndex: 'UserName',
					sorter: true,
					align: 'center',
					key: 'UserName',
				},
				{
					title: '姓名',
					dataIndex: 'DisplayName',
					sorter: true,
					align: 'center',
					key: 'DisplayName',
				},
				{
					title: '学号',
					dataIndex: 'StuNo',
					sorter: true,
					align: 'center',
					key: 'StuNo',
				},
				{
					title: '院系',
					dataIndex: 'SubName',
					sorter: true,
					align: 'center',
					key: 'SubName',
				},
				{
					title: '专业',
					dataIndex: 'MajorName',
					sorter: true,
					align: 'center',
					key: 'MajorName',
				},
				{
					title: '年级',
					dataIndex: 'GradeName',
					sorter: true,
					align: 'center',
					key: 'GradeName',
				},
				{
					title: '班级',
					dataIndex: 'ClassName',
					sorter: true,
					align: 'center',
					key: 'ClassName',
				},
			],
			//学生管理
			dataList: [],
			columns: [
				{
					title: '序号',
					dataIndex: 'Number',
					align: 'center',
					key: 'Number',
				},
				{
					title: '用户名',
					dataIndex: 'UserName',
					sorter: true,
					align: 'center',
					key: 'UserName',
				},
				{
					title: '姓名',
					dataIndex: 'DisplayName',
					sorter: true,
					align: 'center',
					key: 'DisplayName',
				},
				{
					title: '照片',
					dataIndex: 'AvatorUrl',
					sorter: true,
					align: 'center',
					key: 'AvatorUrl',
					scopedSlots: {
						customRender: 'AvatorUrl',
					},
				},
				{
					title: '院系',
					dataIndex: 'SubName',
					sorter: true,
					align: 'center',
					key: 'SubName',
				},
				{
					title: '专业',
					dataIndex: 'MajorName',
					sorter: true,
					align: 'center',
					key: 'MajorName',
				},
				{
					title: '年级',
					dataIndex: 'GradeName',
					sorter: true,
					align: 'center',
					key: 'GradeName',
				},
				{
					title: '班级',
					sorter: true,
					dataIndex: 'ClassName',
					align: 'center',
					key: 'ClassName',
				},
				{
					title: '手机号',
					dataIndex: 'Mobile',
					sorter: true,
					align: 'center',
					key: 'Mobile',
				},
				{
					title: '邮箱',
					dataIndex: 'Email',
					sorter: true,
					align: 'center',
					key: 'Email',
				},
				{
					title: '性别',
					dataIndex: 'Sex',
					sorter: true,
					align: 'center',
					key: 'Sex',
				},
				{
					title: '操作',
					key: 'action',
					scopedSlots: { customRender: 'action' },
					align: 'center',
					width: '25%',
				},
			],
			subId: '',
			userdisable: false,
			isOnlyMoble: false,
			isOnlyInfo: false,
			gradeId: '',
			majorId: '',
			classId: '',
			ids: [],
			studentId: '',
			idstudents: [],
			//职教云
			zjyclasslist: [],
			zjysublist: [],
			zjygradelist: [],
			uploading: false,
			zjyclassid: '',
			zjygradeid: '',
			zjysubid: '',
			setAvatorUrl: '',
			importExcel: false,
			importStuAvatorUrl: false,
			touXiangDialog: false,
			fileList: [],
			// 上传准考证的文件列表
			files: [],
			lock: false,
			fileCount: 0,
			errorList: [],
			dataSource: [],
			errorColumns: [
				{
					title: '序号',
					dataIndex: 'Number',
					align: 'center',
				},
				{
					title: '明细',
					dataIndex: 'Title',
					align: 'center',
				},
			],
			importAvatorUrl: false,
			fileCountAvatorUrl: 0,
			errorListAvatorUrl: [],
			errorColumnsAvatorUrl: [
				{
					title: '序号',
					dataIndex: 'Number',
					align: 'center',
				},
				{
					title: '明细',
					dataIndex: 'Title',
					align: 'center',
				},
			],
			isContinue: false,
			rowList: [],
		};
	},
	watch: {
		files(val) {
			console.log('批量上传');
			console.log(val);
		},
		fileListOne(val) {
			if (val.length == 0) {
				this.setAvatorUrl = '';
				this.form.fileListOne = [];
			} else {
				this.form.fileListOne = val;
			}
		},
	},
	beforeRouteEnter(to, from, next) {
		next((vm) => {
			vm.getOpeartion();
		});
	},
	methods: {
		onClassCancle() {
			this.editClass = false;
			this.form.ClassName = [];
			this.classId = '';
		},
		afterClose() {
			this.fileListOne = [];
			this.$refs['ruleForm'].resetFields();
		},
		offBatchupload() {
			this.files = [];
			this.importStuAvatorUrl = false;
		},
		closeex() {
			this.visible = false;
			this.exportName = '';
			this.zjysub = undefined;
			this.zjyclass = undefined;
			this.zjygrade = undefined;
			this.zjysubid = undefined;
			this.zjygradeid = undefined;
			this.zjyclassid = undefined;
		},
		getIsWrite(type) {
			type = 'add/edit/del';
			let index = this.IsOpList.findIndex((el) => {
				return el.Name === type;
			});
			if (index > -1) {
				if (this.IsOpList[index].IsRead && !this.IsOpList[index].IsWrite) {
					this.$message.info('您没有该操作权限！');
					return false;
				} else {
					return true;
				}
			}
		},
		handleChangeEmail(value) {
			this.dataSource =
				!value || value.indexOf('@') >= 0 ? [] : [`${value}@gmail.com`, `${value}@163.com`, `${value}@qq.com`];
		},
		zjyclasses(value) {
			this.zjyclassid = value;
		},
		zjygrades(value) {
			this.zjygradeid = value;
		},
		zjysubs(value) {
			this.zjysubid = value;
		},
		Changeclass(value) {
			this.classId = value;
		},
		Changemajor(value) {
			this.majorId = value;
			this.getClassList();
			if (this.classId) {
				this.form.ClassName = [];
				this.classId = '';
			}
		},
		Changegrade(value) {
			this.gradeId = value;
			this.getClassList();
			if (this.classId) {
				this.form.ClassName = [];
				this.classId = '';
			}
		},
		//获取职教云院系班级年级
		getzjySubList() {
			this.$http
				.post('/api/common/localstorage/getSubList', {
					q: this.selectType,
				})
				.then((rst) => {
					this.zjysublist = rst.list;
				});
		},
		getzjyGradeList() {
			this.$http
				.post('/api/common/localstorage/getGradeList', {
					q: this.selectType,
				})
				.then((rst) => {
					this.zjygradelist = rst.list;
				});
		},
		getzjyClassList() {
			this.$http
				.post('/api/common/localstorage/getClassList', {
					q: this.selectType,
				})
				.then((rst) => {
					this.zjyclasslist = rst.list;
				});
		},
		//获取院系
		getSubList() {
			this.$http
				.post('/api/common/localstorage/getESSubList', {
					q: this.selectType,
				})
				.then((rst) => {
					this.sublist = rst.list;
				});
		},
		//获取年级
		getGradeList() {
			this.$http
				.post('/api/common/localstorage/getESGradeList', {
					q: this.selectType,
				})
				.then((rst) => {
					this.gradelist = rst.list;
				});
		},
		//获取专业
		getMajorList() {
			this.$http
				.post('/api/common/localstorage/getESMajorList', {
					q: this.selectType,
					subId: this.subId,
				})
				.then((rst) => {
					this.majorlist = rst.list;
				});
		},
		//搜索职教云
		getZJYList() {
			if (!this.getIsWrite('新增')) {
				return;
			}
			this.getZJYStuList();
		},
		//职教云学生获取
		getZJYStuList(page, pageSize, sortOrder) {
			this.loading = true;
			this.$http
				.post('/api/SchoolManager/student/getZJYStuList', {
					subId: this.zjysubid,
					gradeId: this.zjygradeid,
					stu: this.exportName,
					classId: this.zjyclassid,
					sort: sortOrder || '',
					page: page || 1,
					pageSize: pageSize || 10,
				})
				.then((rst) => {
					this.loading = false;
					if (rst.code == 1) {
						this.student = [];
						this.paginationex.current = rst.pagination.pageIndex;
						this.paginationex.pageSize = rst.pagination.pageSize;
						this.paginationex.total = rst.pagination.totalCount;
						if (rst.list.length) {
							rst.list.forEach((item, index) => {
								let number = (rst.pagination.pageIndex - 1) * rst.pagination.pageSize + index + 1;
								this.student.push({
									...item,
									Number: number,
								});
								// console.log(this.dataList);
							});
						}
					} else {
						this.$message.error(rst.msg);
					}
				})
				.finally(() => {
					this.loading = false;
				});
		},
		//批量删除
		deleted() {
			if (!this.getIsWrite('删除')) {
				return;
			}
			if (this.idstudents.length === 0) {
				this.$message.error('请选择要删除的数据');
				return;
			}
			this.$http
				.post('/api/SchoolManager/student/delete', {
					ids: this.idstudents, //要删除的成员id数组
				})
				.then((res) => {
					if (res.code > 0) {
						this.$message.success(res.msg);
						this.getStudentList();
						this.idstudents = [];
						this.selectedStudent = [];
					} else {
						this.$message.error(res.msg);
					}
				});
		},
		//修改班级
		updateClass() {
			if (!this.getIsWrite('编辑')) {
				return;
			}
			if (this.idstudents.length === 0) {
				this.$message.error('请选择要修改的数据');
				return;
			}
			this.editClass = true;
		},
		saveClass() {
			if (!this.getIsWrite('编辑')) {
				return;
			}
			if (this.idstudents.length === 0) {
				this.$message.error('请选择要修改的数据');
				return;
			}
			if (this.classId == '') {
				this.$message.error('请选择班级');
				return;
			}
			this.$http
				.post('/api/SchoolManager/student/saveClass', {
					ids: this.idstudents, //要删除的成员id数组
					classId: this.classId,
				})
				.then((res) => {
					if (res.code > 0) {
						this.$message.success(res.msg);
						this.getStudentList();
						this.idstudents = [];
						this.classId = '';
						this.editClass = false;
						this.selectedStudent = [];
					} else {
						this.$message.error(res.msg);
					}
				});
		},
		//重置密码
		resetPwd() {
			if (!this.getIsWrite('重置密码')) {
				return;
			}
			if (this.idstudents.length === 0) {
				this.$message.error('请选择要重置密码的数据');
				return;
			}
			this.$confirm({
				title: '提示',
				content: '确认重置选择数据的密码吗？',
				centered: true,
				onOk: () => {
					this.$http
						.post('/api/common/accounts/resetPwd', {
							id: this.idstudents,
						})
						.then((res) => {
							if (res.code > 0) {
								this.$message.success(res.msg);
								this.selectedStudent = [];
								this.idstudents = [];
							} else {
								this.$message.error(res.msg);
							}
						});
				},
				onCancel() {},
			});
		},

		//学生头像上传
		onAllFilesUpload() {
			let fileList = [];

			for (let i = 0; i < this.files.length; i++) {
				let lis = {
					docId: '',
					docUrl: '',
					fileName: '',
				};
				lis.docId = this.files[i].uid;
				lis.docUrl = this.files[i].url;
				lis.fileName = this.files[i].name.split('.')[0];
				console.log(lis);
				fileList.push(lis);
			}

			this.loading = true;
			this.$http
				.post('/api/schoolManager/student/saveStudentFile', {
					fileList: JSON.stringify(fileList),
				})
				.then((res) => {
					this.errorList = [];

					if (res.code > 0) {
						if (res.list.length == 0) {
							this.$message.success(res.msg);
							this.offBatchupload();
						} else {
							res.list.forEach((item, index) => {
								this.errorList.push({
									Title: item,
									Number: index + 1,
								});
							});
						}
						this.getStudentList();
					} else {
						this.$message.warning(res.msg);
					}
				});
		},

		//导入职教云学生
		importZJYStudent() {
			this.$http
				.post('/api/SchoolManager/student/importZJYStudent', {
					ids: this.ids,
				})
				.then((res) => {
					if (res.code > 0) {
						this.visible = false;
						this.$message.success(res.msg);
						this.getStudentList();
						this.getClassList();
						this.getMajorList();
						this.getSubList();
						this.getGradeList();
						this.ids = [];
						this.selectedRowKeys = [];
						this.exportName = '';
						this.zjysub = undefined;
						this.zjyclass = undefined;
						this.zjygrade = undefined;
					} else {
						this.$message.error(res.msg);
					}
				});
		},
		//成绩排序
		TableChange(pagenation, filter, sort) {
			let sortOrder = '';
			console.log('pagenation');
			console.log(sort.order);
			console.log(sort.columnKey);
			console.log('columnKey');
			if (sort.order) {
				if (sort.order == 'ascend') {
					sortOrder = sort.columnKey;
				} else if (sort.order == 'descend') {
					sortOrder = '-' + sort.columnKey;
				} else {
					sortOrder = '';
				}
			}
			console.log(this.paginationDetail.current, this.paginationDetail.pageSize);
			this.getScoreDetails(this.paginationDetail.current, this.paginationDetail.pageSize, sortOrder);
		},
		//编辑保存
		saveedit() {
			let id = this.texttitle === '编辑信息' ? this.lookItem.Id : '';
			console.log(this.texttitle);
			let avatorUrl = '';
			if (this.setAvatorUrl) {
				avatorUrl = this.setAvatorUrl;
			} else {
				if (this.fileListOne.length > 0) {
					avatorUrl = this.fileListOne[0].response.url;
				}
			}
			this.loading = true;
			this.$refs.ruleForm.validate((valid) => {
				if (valid) {
					this.$http
						.post('/api/SchoolManager/Student/saveInfo', {
							id,
							userName: this.form.UserName,
							displayName: this.form.DisplayName,
							userNo: this.form.UserNo,
							subId: this.subId,
							gradeId: this.gradeId,
							// majorId: this.majorId,
							classId: this.classId,
							avatorUrl: avatorUrl,
							mobile: this.form.Mobile,
							sex: this.form.Sex,
							email: this.form.Email,
						})
						.then((rst) => {
							this.loading = false;
							if (rst.code === 1) {
								this.lookItem = '';
								this.add = false;
								this.userdisable = false;
								this.isOnlyMoble = false;
								this.isOnlyInfo = false;
								this.$refs['ruleForm'].resetFields();
								let msg = this.texttitle === '编辑信息' ? '修改成功' : '新增成功';
								this.$message.success(rst.msg);
								this.getStudentList();
							} else {
								this.$message.error(rst.msg);
							}
						})
						.finally(() => {
							this.loading = false;
						});
				} else {
					console.log('error submit!!');
					this.loading = false;
					this.userdisable = false;
					this.isOnlyMoble = false;
					this.isOnlyInfo = false;
					return false;
				}
			});
		},
		// 获取页面操作
		getOpeartion() {
			this.loading = true;
			this.GetOperationList()
				.then((rst) => {
					this.loading = false;
					this.loading = false;
					this.operationList = [];
					this.IsOpList = [];
					if (rst.code === 1) {
						if (rst.list.length) {
							rst.list.forEach((item) => {
								if (item.IsWrite) {
									this.operationList.push(item.Name);
								}
							});
							this.IsOpList = rst.list;
							// this.operationList = rst.list;
						}
						this.getStudentList();
						this.getClassList();
						this.getMajorList();
						this.getSubList();
						this.getGradeList();
						this.getzjySubList();
						this.getzjyGradeList();
						this.getzjyClassList();
					} else {
						this.$message.error(rst.msg);
					}
				})
				.finally(() => {
					this.loading = false;
				});
		},
		// 点击table排序
		onTableChange(pagenation, filter, sort) {
			let sortOrder = '';
			this.selectedStudent = [];
			if (sort.order) {
				if (sort.order == 'ascend') {
					sortOrder = sort.columnKey;
				} else if (sort.order == 'descend') {
					sortOrder = '-' + sort.columnKey;
				} else {
					sortOrder = '';
				}
			}
			this.getStudentList(pagenation.current, pagenation.pageSize, sortOrder);
		},
		exChange(pagenation, filter, sort) {
			let sortOrder = '';
			this.selectedRowKeys = [];
			if (sort.order) {
				if (sort.order == 'ascend') {
					sortOrder = sort.columnKey;
				} else if (sort.order == 'descend') {
					sortOrder = '-' + sort.columnKey;
				} else {
					sortOrder = '';
				}
			}
			this.getZJYStuList(pagenation.current, pagenation.pageSize, sortOrder);
		},
		//获取班级
		getClassList() {
			this.$http
				.post('/api/common/localstorage/getESClassList', {
					q: this.selectType,
					majorId: this.majorId,
					gradeId: this.gradeId,
				})
				.then((rst) => {
					this.classlist = rst.list;
				});
		},
		//获取学生数据
		getStudentList(page, pageSize, sortOrder) {
			this.loading = true;
			this.$http
				.post('/api/SchoolManager/Student/getStudentList', {
					userNo: this.username,
					classId: this.classid,
					sort: sortOrder || '',
					page: page || 1,
					pageSize: pageSize || 10,
				})
				.then((rst) => {
					this.loading = false;
					if (rst.code > 0) {
						if (rst.isZjySchool) {
							this.isShow = true;
						}
						this.dataList = [];
						this.pagination.current = rst.pagination.pageIndex;
						this.pagination.pageSize = rst.pagination.pageSize;
						this.pagination.total = rst.pagination.totalCount;
						if (rst.list.length) {
							rst.list.forEach((item, index) => {
								let number = (rst.pagination.pageIndex - 1) * rst.pagination.pageSize + index + 1;
								this.dataList.push({
									...item,
									Number: number,
								});
								// console.log(this.dataList);
							});
						}
					} else {
						this.$message.error(rst.msg);
					}
				})
				.finally(() => {
					this.loading = false;
				});
		},
		//获取学生成绩详情
		getScoreDetails(page, pageSize, sortOrder) {
			this.$http
				.post('/api/SchoolManager/Student/getScoreDetails', {
					studentId: this.studentId,
					title: this.exam,
					sort: sortOrder || '',
					page: page || 1,
					pageSize: pageSize || 10,
				})
				.then((rst) => {
					console.log(rst);
					this.loading = false;
					this.gradeSource = rst.list;
					if (rst.code == 1) {
						this.gradeSource = [];
						this.paginationDetail.current = rst.pagination.pageIndex;
						this.paginationDetail.pageSize = rst.pagination.pageSize;
						this.paginationDetail.total = rst.pagination.totalCount;
						if (rst.list.length) {
							rst.list.forEach((item, index) => {
								let number = (rst.pagination.pageIndex - 1) * rst.pagination.pageSize + index + 1;
								this.gradeSource.push({
									...item,
									Number: number,
								});
							});
						}
					} else {
						this.$message.error(rst.msg);
					}
				})
				.finally(() => {
					this.loading = false;
				});
		},
		// 点击操作
		clickAction(type, data) {
			let index = this.IsOpList.findIndex((el) => {
				return el.Name === type;
			});
			if (index > -1) {
				// this.IsOpList[index].IsRead
				if (this.IsOpList[index].IsRead && !this.IsOpList[index].IsWrite) {
					this.$message.info('您没有该操作权限，请先进行添加！');
					return;
				}
			}
			switch (type) {
				case '查看':
					this.grade = true;
					this.loading = true;
					this.exam = '';
					this.studentId = data.Id;
					this.getScoreDetails(data);

					break;
				case '编辑':
					this.add = true;
					this.lookItem = data;
					this.texttitle = '编辑信息';
					this.userdisable = true;
					this.isOnlyMoble = false;
					this.isOnlyInfo = false;
					this.$http
						.post('/api/SchoolManager/Student/editInfo', {
							id: data.Id,
						})
						.then((res) => {
							this.form = res.info;
							this.majorId = res.info.MajorId;
							this.classId = res.info.ClassId;
							this.isOnlyInfo = res.isOnlyInfo;
							this.isOnlyMoble = res.isOnlyMoble;
							this.form.SubName = res.info.SubName ? res.info.SubName : undefined;
							this.form.Email = res.info.Email ? res.info.Email : undefined;
							this.form.MajorName = res.info.MajorName ? res.info.MajorName : undefined;
							this.form.GradeName = res.info.GradeName ? res.info.GradeName : undefined;
							this.form.ClassName = res.info.ClassName ? res.info.ClassName : undefined;
							this.form.Mobile = res.info.Mobile ? res.info.Mobile : undefined;
							this.form.Sex = res.info.Sex ? res.info.Sex : undefined;
							this.setAvatorUrl = res.info.Url;
							if (res.info.AvatorUrl) {
								this.fileListOne = [
									{
										uid: data.Id,
										docUrl: res.info.Url,
										url: res.info.AvatorUrl,
									},
								];
							} else {
								this.fileListOne = [];
							}
						});
					// this.form = data ? data : {};
					break;
				case '删除':
					if (!this.getIsWrite('删除')) {
						return;
					}
					this.$confirm({
						title: '提示',
						content: '你确定要删除该信息吗？',
						centered: true,
						onOk: () => {
							// var Id = [data.Id];
							this.$http
								.post('/api/SchoolManager/student/delete', {
									ids: data.Id,
								})
								.then((rst) => {
									if (rst.code === 1) {
										this.$message.success(rst.msg);
										this.getStudentList();
										this.selectedRowKeys = [];
									} else {
										this.$message.error(rst.msg);
									}
								});
						},
						onCancel() {},
					});
					break;
				case '新增':
					if (!this.getIsWrite('新增')) {
						return;
					}
					this.gradeId = '';
					this.majorId = '';
					this.classId = '';
					this.getClassList();
					this.userdisable = false;
					this.add = true;
					this.texttitle = '新增信息';
					this.form = data ? data : {};
					break;

				default:
					break;
			}
		},
		Changesub(value) {
			this.subId = value;
			this.getMajorList();
			if (this.majorId) {
				this.form.MajorName = [];
				this.majorId = '';
			}
			this.getClassList();
			if (this.classId) {
				this.form.ClassName = [];
				this.classId = '';
			}
			// this.getGradeList();
			// if (this.gradeId) {
			//   this.form.GradeName = [];
			//   this.gradeId = '';
			// }

			// console.log('subid', this.subId);
		},
		handleSearch(value) {
			this.selectType = value;
			this.getClassList();
		},
		handleChange(value) {
			this.classid = value;
		},
		handleFocus() {
			this.selectType = '';
			this.getClassList();
		},
		//导入
		showModal() {
			if (!this.getIsWrite('新增')) {
				return;
			}
			this.visible = true;
			this.getZJYStuList();
		},
		handleCancel(e) {
			console.log('Clicked cancel button');
			this.visible = false;
		},
		//删除多选
		onSelectStudent(selectedRowKeys, selectedRows) {
			this.selectedStudent = selectedRowKeys;
			var ids = [];
			for (let i = 0; i < selectedRows.length; i++) {
				ids.push(selectedRows[i].Id);
			}
			this.idstudents = ids;
			console.log('idstudents', this.idstudents);
		},
		//导入多选
		onSelectChange(selectedRowKeys, selectedRows) {
			this.selectedRowKeys = selectedRowKeys;
			var ids = [];
			for (let i = 0; i < selectedRows.length; i++) {
				ids.push(selectedRows[i].Id);
			}
			this.ids = ids;
		},
		importedCancelExcel() {
			this.importExcel = false;
			this.isContinue = false;
			this.rowList = [];
		},

		//点击excel导入
		importExcelQues() {
			if (!this.getIsWrite('新增')) {
				return;
			}
			this.fileCount = 0;
			this.errorList = [];
			this.fileList = [];
			this.importExcel = true;
			this.isContinue = false;
			this.rowList = [];
		},
		//点击导入学生头像
		uploadAvator() {
			if (!this.getIsWrite('上传头像')) {
				return;
			}
			this.fileCount = 0;
			this.fileList = [];
			this.errorList = [];
			this.importStuAvatorUrl = true;
		},
		//删除文件
		handleRemove(file) {
			const index = this.fileList.indexOf(file);
			const newFileList = this.fileList.slice();
			newFileList.splice(index, 1);
			this.fileList = newFileList;
			this.errorList = [];
			this.isContinue = false;
			this.rowList = [];
		},
		handleRemoveword(file) {
			const index = this.fileListword.indexOf(file);
			const newFileList = this.fileListword.slice();
			newFileList.splice(index, 1);
			this.fileListword = newFileList;
			this.errorListword = [];
		},
		//选择文件
		beforeUpload(file) {
			this.fileList = [];
			this.fileCount = 1;
			this.fileList = [...this.fileList, file];
			this.isContinue = false;
			this.rowList = [];
			this.errorList = [];
			return false;
		},
		//上传
		handleUpload(type) {
			if (this.lock) {
				return;
			}
			var api = '/api/schoolManager/student/importExcelStu';
			if (type == 1) {
				api = '/api/schoolManager/student/continueImpStu';
			} else {
				this.errorList = [];
			}
			this.uploading = true;
			const { fileList } = this;
			const formData = new FormData();
			fileList.forEach((file) => {
				formData.append('files[]', file);
				formData.append('rowList', this.rowList);
			});
			this.lock = true;
			this.$http.post(api, formData).then((res) => {
				this.lock = false;
				this.isContinue = false;
				this.errorList = [];
				this.uploading = false;
				if (res.code > 0) {
					this.fileCount = 0;
					this.importExcel = false;
					this.getStudentList();
					this.$message.success(res.msg);
				} else if (res.code == -100) {
					this.rowList = res.errorRowList;
					this.isContinue = true;
					this.$message.error(res.msg);
					if (res.list.length) {
						res.list.forEach((item, index) => {
							this.errorList.push({
								Title: item,
								Number: index + 1,
							});
						});
					}
				} else {
					this.fileCount = 0;
					this.$message.error(res.msg);
				}
			});
		},
		importedCancelAvatorUrl() {
			this.importAvatorUrl = false;
		},
		//点击excel导入
		importExcelQuesAvatorUrl() {
			if (!this.getIsWrite('新增')) {
				return;
			}
			this.fileCountAvatorUrl = 0;
			this.errorList = [];
			this.fileListAvatorUrl = [];
			this.importAvatorUrl = true;
		},
		//删除文件
		handleRemoveAvatorUrl(file) {
			const index = this.fileListAvatorUrl.indexOf(file);
			const newFileList = this.fileListAvatorUrl.slice();
			newFileList.splice(index, 1);
			this.fileListAvatorUrl = newFileList;
			this.errorList = [];
		},
		//选择文件
		beforeUploadAvatorUrl(file) {
			this.fileListAvatorUrl = [];
			this.fileCountAvatorUrl = 1;
			this.fileListAvatorUrl = [...this.fileListAvatorUrl, file];
			return false;
		},
		//上传
		handleUploadAvatorUrl() {
			this.uploading = true;
			const { fileListAvatorUrl } = this;
			const formData = new FormData();
			fileListAvatorUrl.forEach((file) => {
				formData.append('files[]', file);
				formData.append('courseId', this.$route.params.addid);
			});
			if (this.lock) {
				return;
			}
			this.lock = true;
			this.$http.post('/api/schoolManager/student/import', formData).then((res) => {
				this.lock = false;
				this.fileCountAvatorUrl = 0;
				this.errorList = [];
				this.uploading = false;
				if (res.code == 100) {
					this.getStudentList();
					this.$message.success(res.msg);
					if (res.list.length) {
						res.list.forEach((item, index) => {
							this.errorList.push({
								Title: item,
								Number: index + 1,
							});
							// console.log(this.datas);
						});
					}
				} else if (res.code > 0) {
					this.importAvatorUrl = false;
					this.getStudentList();
					this.$message.success(res.msg);
				} else {
					this.$message.error(res.msg);
					// this.errorList = res.list;
					if (res.list.length) {
						res.list.forEach((item, index) => {
							this.errorList.push({
								Title: item,
								Number: index + 1,
							});
							// console.log(this.datas);
						});
					}
				}
			});
		},
		// 关闭职教云导入的回调
		afterCloseImport() {
			this.selectedRowKeys = [];
			this.ids = [];
			this.closeex();
		},
	},
};
</script>

<style></style>
